From: Glenn Morris Date: Wed, 13 Oct 2010 23:43:39 +0000 (+0200) Subject: lisp/subr.el (last): Deal with dotted lists (reported in bug#7174). X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1~1^2~324^2~6091 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=521a62039121b4a6612a0024e0d6816713514529;p=emacs.git lisp/subr.el (last): Deal with dotted lists (reported in bug#7174). --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bed00b43055..bd0be0bcea7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2010-10-13 Glenn Morris + + * subr.el (last): Deal with dotted lists (reported in bug#7174). + 2010-10-13 Stephen Berman * subr.el (last): Use `safe-length' instead of `length' (bug#7206). diff --git a/lisp/subr.el b/lisp/subr.el index dabadec770e..8c42e5bd66a 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -289,7 +289,7 @@ If LIST is nil, return nil. If N is non-nil, return the Nth-to-last link of LIST. If N is bigger than the length of LIST, return LIST." (if n - (and (> n 0) + (and (>= n 0) (let ((m (safe-length list))) (if (< n m) (nthcdr (- m n) list) list))) (and list